// tslint:disable-next-line:ordered-imports
import query from '@dfeidao/atom-nodejs/db/query';
import { IncomingHttpHeaders } from 'http';
import { productid, systemid } from '../../atom/config';
interface Message {
	project_asset_no: string;
}


export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	const q = query(action_id, session_id, systemid);
	// 项目资产数据
	q.prepare('project_assets', ['asset_classification_no', 'project_no', 'assetsname', 'place',
		'equip_depart_name', 'asset_grade', 'timeout_alert', 'brand_no', 'remark', 'timeout_reminder_time',
		'unitprice', 'customer_assets', 'maintenance_time'],
		{ productid, project_asset_no: message.project_asset_no }, 20, 1, [], ['maintenance_time']);
	// 资产分类
	q.prepare('asset_classification', ['asset_classification_no', 'asset_classification_name'], { productid }, 200, 1, [], []);
	// 项目名称
	q.prepare('company_project', ['project_name', 'project_no'], { productid }, 200, 1, [], []);
	const [dt1, dt2, dt3] = await q.exec();
	return { dt1, dt2, dt3 };
}
